

  <div class="well">
	<form action='<?php echo $this->webroot;?>Users/ricerca' method='post' id='form_ricerca' class='form-vertical'>
      <div class="control-group">
        <label class="control-label">Ricerca avanzata</label>
        <div class="controls">
          <div class="form-actions">
			<p>Username<br/>
			<input type="text" name="conditions[users][User.username]" value="<? if (isset($conditions['users']['User.username'])) echo $conditions['users']['User.username'] ?>" />
			</p>
			<p>Cognome<br/>
			<input type="text" name="conditions[users][Anagrafica.cognome]" value="<? if (isset($conditions['users']['Anagrafica.cognome'])) echo $conditions['users']['Anagrafica.cognome'] ?>"/>
			</p>
		
			<p>Categoria<br />
			<select name='conditions[users][User.group_id]'>
				<option value=''></option>";
				<?foreach ($groups as $key => $group) {?>
					<option value='<? echo $key?>' <?if(isset($conditions) && isset($conditions['users']['User.group_id']) && $key == $conditions['users']['User.group_id']) echo " selected='selected' " ?> ><? echo $group ?></option>";
				<? } ?> 
			</select>
			</p>
			<p>
				<button type="submit" class="btn btn-primary"><i class="icon-search"></i></button>
				<a href='<?php echo $this->webroot;?>Users/rimuoviFiltri' class="btn"><i class="icon-remove"></i></a>
			</p>
          </div>
        </div>
      </div>
    </form>
  </div>


<script>
	function ricerca() {
		$("#form_ricerca").attr("action", "<?php echo $this->webroot;?>Libri/ricerca").submit(); 
	}
</script>